package KK.WindowSkin
{
	import flash.geom.Rectangle;

	public class SkinSheet implements IWindowSkin
	{
		private static const MAX_GRID:int=9;
		private static const MAX_SKIN:int=17;
		
		private var _skin:Vector.<Rectangle>;
		
		private var _sudoku:Vector.<Rectangle>;
		
		
		private var _tileWidth:int=0;
		private var _tileHeight:int=0;
		public function SkinSheet()
		{
			init();
		}
		
		/**
		 * 初始化  
		 * 
		 */
		private function init():void{
			_skin=new Vector.<Rectangle>(MAX_SKIN,true);
			
			
			_skin[0]=new Rectangle(0,0,64,64); 
			var i:int=0; 
			
			var rowWidth:int=16;
			var colHeight:int=16;
			var row:int=0;
			var col:int=0; 
			while(i<16){
				row=i%4;
				col=Math.floor(i/4);
				_skin[i+1]=new Rectangle(64+rowWidth*row,col*colHeight,rowWidth,colHeight);
				i++;
			} 
			 
			
			
			_sudoku=new Vector.<Rectangle>(MAX_GRID,true);
			
			_sudoku[0]=LT;
			_sudoku[1]=TT;
			_sudoku[2]=RT;
			_sudoku[3]=LM;
			_sudoku[4]=Fill;
			_sudoku[5]=RM;
			_sudoku[6]=LB;
			_sudoku[7]=MB;
			_sudoku[8]=RB;
			
			_tileWidth=64;
			_tileHeight=64;
			
		}
		
		
		
		/**
		 * 填充区域 
		 * @return 
		 * 
		 */
		public function get Fill():Rectangle{
			return _skin[0];
		}
		
		/**
		 * 获取左上 
		 * @return 
		 * 
		 */
		public function get LT():Rectangle{
			return _skin[1];
		}
		
		public function get LB():Rectangle
		{
			// TODO Auto Generated method stub
			return _skin[13];
		}
		
		public function get LM():Rectangle
		{
			// TODO Auto Generated method stub
			return _skin[5];
		}
		
		public function get MB():Rectangle
		{
			// TODO Auto Generated method stub
			return _skin[14];
		}
		
		public function get MM():Rectangle
		{
			// TODO Auto Generated method stub
			return _skin[6];
		}
		
		public function get RB():Rectangle
		{
			// TODO Auto Generated method stub
			return _skin[16];
		}
		
		public function get RM():Rectangle
		{
			// TODO Auto Generated method stub
			return _skin[8];
		}
		
		public function get RT():Rectangle
		{
			// TODO Auto Generated method stub
			return _skin[4];
		}
		
		public function get TT():Rectangle
		{
			// TODO Auto Generated method stub
			return _skin[2];
		}
		
		
		/**
		 * 获取九宫格区域 
		 * @return 
		 * 
		 */
		public function get Sudoku():Vector.<Rectangle>{
			return _sudoku;
		}
		
		/**
		 * 获取块最大高度  
		 * @return 
		 * 
		 */
		public function get MaxTileHeight():int{
			return _tileHeight;
		}
		
		/**
		 * 获取块最大宽度 
		 * @return 
		 * 
		 */
		public function get MaxTileWidth():int{
			return _tileWidth;
		}
	}
}